<?php

App::uses('AppController', 'Controller');

/**
 * Residentials Controller
 *
 */
class ResidentialsController extends AppController {

    /**
     * Scaffold
     *
     * @var mixed
     */
    public $scaffold;
    public $uses = array('Project','Province','PropertyType');

    public function index($project_type_id = NULL, $propertyId = NULL) {
        $this->set('lists', $this->Project->listAllGuest($project_type_id, $propertyId));
    }

    public function resale($propertyId = NULL, $propertyTypeId = NULL) {
        $latest = $this->Project->listAllDetail(2, $propertyId, $propertyTypeId, LIMIT_PER_PAGE);
        $houseArr = $this->Project->listAllDetail(2, $propertyId, 10, LIMIT_PER_PAGE);
        $condoArr = $this->Project->listAllDetail(2, $propertyId, 1, LIMIT_PER_PAGE);
        
        $dataAll = array(
            array(
                'title' => 'Latest',
                'data' => $latest
            ),
            array(
                'title' => 'DETACHBD HOUSE',
                'data' => $houseArr
            ),
             array(
                'title' => 'CONDOMINIUM',
                'data' => $condoArr
            )
        );
        //debug($dataAll);
        $this->set('dataAll', $dataAll);
    }

    public function newProject($propertyId = NULL, $propertyTypeId = NULL) {
        $latest = $this->Project->listAllDetail(1, $propertyId, $propertyTypeId, LIMIT_PER_PAGE);
        $houseArr = $this->Project->listAllDetail(1, $propertyId, 10, LIMIT_PER_PAGE);
        $condoArr = $this->Project->listAllDetail(1, $propertyId, 1, LIMIT_PER_PAGE);
        $dataAll = array(
            array(
                'title' => 'Latest',
                'data' => $latest
            ),
            array(
                'title' => 'DETACHBD HOUSE',
                'data' => $houseArr
            ),
             array(
                'title' => 'CONDOMINIUM',
                'data' => $condoArr
            )
        );
        //debug($dataAll);
        $this->set('dataAll', $dataAll);
        $this->set('province', $this->Province->listOption($this->Session->read('Config.language')));
        $this->set('properties', $this->PropertyType->listOptionToDropdown());
    }

    public function type($projectTypeId = NULL, $propertyId = NULL, $propertyTypeId = NULL) {
        $this->set('newArr', $this->Project->listAllDetail($projectTypeId, $propertyId, $propertyTypeId));
    }

}
